﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace Synchros
{
   public class SyncItem
    {
       private DateTime _LastDt = DateTime.Now;
       private int iSpaced = 10;//(秒)
       private string strGpName = string.Empty;
       private bool isSync = true;
       private DataTable dtSyncDb = new DataTable();
       private DataTable dtSyncTb = new DataTable();
       public SyncItem()
       {
           //构建SyncDb
           dtSyncDb.Columns.Add("SdName", typeof(string));
           dtSyncDb.Columns.Add("IsMain",typeof(bool));
           dtSyncDb.Columns.Add("IsSync", typeof(bool));
           dtSyncDb.Columns.Add("SdTime", typeof(String));
           dtSyncDb.Columns.Add("Server", typeof(string));
           dtSyncDb.Columns.Add("Database", typeof(string));
           dtSyncDb.Columns.Add("UserID", typeof(string));
           dtSyncDb.Columns.Add("Password", typeof(string));

           //构建dtSyncTb
           dtSyncTb.Columns.Add("StName", typeof(string));
           dtSyncTb.Columns.Add("IsSync", typeof(bool));
           dtSyncTb.Columns.Add("StTime", typeof(String));//DateTime?
           dtSyncTb.Columns.Add("Column", typeof(DataTable));
       }

       public string SgName
       {
           get { return strGpName; }
           set { strGpName = value; }
       }
       public int Spaced
       {
           get { return iSpaced; }
           set { iSpaced = value; }
       }
       public DateTime LastDt
       {
           get { return _LastDt; }
           set { _LastDt = value; }
       }
       public bool IsSync
       {
           get { return isSync; }
           set { isSync = value; }
       }
       public DataTable SyncDb
       {
           get { return dtSyncDb; }
           set { dtSyncDb = value; }
       }
       public DataTable SyncTb
       {
           get { return dtSyncTb; }
           set { dtSyncTb = value; }
       }

       public static DataTable CreateColumnTable()
       {
           DataTable dtColumn = new DataTable("Column");
           {
               dtColumn.Columns.Add("ScName", typeof(string));
               dtColumn.Columns.Add("ScType", typeof(string));
               dtColumn.Columns.Add("ScSize", typeof(int));
               dtColumn.Columns.Add("ScPkey", typeof(bool));
               dtColumn.Columns.Add("ScIdtt", typeof(bool));
               dtColumn.Columns.Add("DeOnly", typeof(bool));
           }
           return dtColumn;
       }
    }
}
